﻿
using System.Drawing;
using System.Windows.Forms;
using ActiproSoftware.SyntaxEditor;

namespace S3.WMDSLEditor.Client.Forms
{
    public partial class FormNewViewSql : Form
    {
        private string _sql = string.Empty;
        private string _value = string.Empty;

        public FormNewViewSql()
        {
            InitializeComponent();
        }

        public FormNewViewSql(string sql)
        {
            InitializeComponent();

            _sql = sql;
        }

        public string Value
        {
            get { return _value; }
            set { _value = value; }
        }

        private void FormNewViewSql_Load(object sender, System.EventArgs e)
        {
            sqlEditor.Font = new Font("Consolas", 10);
            sqlEditor.LineNumberMarginFont = new Font("Consolas", 10);

            Document doc = new Document();

            doc.LineModificationMarkingEnabled = true;
            doc.TabSize = 2;

            WmdslLanguages.LoadLanguageDefinitionFromResource(Language.SQL, ref doc);

            sqlEditor.Document = doc;

            sqlEditor.Text = _value;
        }

        private void btnOK_Click(object sender, System.EventArgs e)
        {
            _value = sqlEditor.Text;
        }
    }
}
